@using OrchardCore.Commerce.Abstractions.ViewModels
@using OrchardCore.Commerce.Models
@using OrchardCore.Commerce.Promotion.Extensions
@using OrchardCore.Commerce.Tax.Extensions
@using OrchardCore.Settings
@inject ISiteService SiteService

@{
    var line = (ShoppingCartLineViewModel)Model.Line;
    var (oldNetPrice, oldGrossPrice) = line.AdditionalData.GetOldPrices();
    var priceDisplaySettings = await SiteService.GetSettingsAsync<PriceDisplaySettings>();

    // Determine which price format to use based on corresponding site setting.
    var oldPrice = priceDisplaySettings.UseNetPriceDisplay ? oldNetPrice : oldGrossPrice;

    // If old gross price is null, old net price is to be used regardless of price display settings.
    if (oldGrossPrice == null)
    {
        oldPrice = oldNetPrice;
    }

    // Old price should not be shown if there are no discounts.
    if (!line.AdditionalData.GetDiscounts().Any())
    {
        oldPrice = null;
    }
}

<div class="shopping-cart-table-old-price"><del>@oldPrice</del></div>
